<%@ page language="java" import="java.util.*, java.text.*,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.xy.manager.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*, com.zjut.zs.xy.dao.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
	<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
		<title>选考科目成绩填写 - 招生报名系统</title>
        <script src="css/tailwindcss.css"></script>
 		<script src='../plugins/assets/plugins/jquery-3.5.1.min.js'></script>
 		<script type="text/javascript" src="js/select-ui.min.js"></script>
        <style>
            body { font-family: 'Noto Sans SC', sans-serif; background-color: #f8fafc; }
            .card { transition: all 0.3s ease; }
            .card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1); }
            .input-focus { transition: all 0.3s ease; }
            .input-focus:focus { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15); }
        </style>
	</head>

<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {

AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsXyManager xmanager = (ZsXyManager) SpringContextUtil.getBean("ZsXyManager");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsUserinfoManager uimanager = (ZsUserinfoManager) SpringContextUtil.getBean("ZsUserinfoManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);

ZsUserinfo userinfo = new ZsUserinfo();
ZsXy xy = new ZsXy();
ZsUser user = null;
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");
}
if (user!=null) {
	xy.setZsUser(user);
	List list = xmanager.getDataByInstance(1,1,null,null,xy).getObjects();
	if (list.size()>0) {
		xy = (ZsXy)list.get(0);
	}
	userinfo.setZsUser(user);
	list = uimanager.getDataByInstance(1,1,null,null,userinfo).getObjects();
	if (list.size()>0) {
		userinfo = (ZsUserinfo)list.get(0);
	}
}
ZsUserStatus userStatus = smanager.getDataByUser(user);
 %>


    <div class="max-w-6xl mx-auto px-4 py-8">


        <!-- 报考类型选择卡片 -->
        <div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
            <h2 class="text-lg font-semibold text-gray-900 mb-4 flex items-center">
                <svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
                    <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v3.586L7.707 9.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                </svg>
                报考类型 <span class="text-red-500 ml-1">*</span>
            </h2>
            <div class="flex flex-wrap gap-6">
                <label class="inline-flex items-center">
                    <input type="radio" name="scColumn1" id="scColumn1" value="普通生" class="h-4 w-4 text-blue-600 border-gray-300 focus:ring-blue-500" <%out.println("普通生".equals(userStatus.getScColumn1()) ? "checked" : "");%>>
                    <span class="ml-2 text-gray-700">普通生</span>
                </label>
                <label class="inline-flex items-center">
                    <input type="radio" name="scColumn1" id="scColumn1" value="特长生" class="h-4 w-4 text-blue-600 border-gray-300 focus:ring-blue-500" <%out.println("特长生".equals(userStatus.getScColumn1()) ? "checked" : "");%>>
                    <span class="ml-2 text-gray-700">特长生</span>
                </label>
            </div>
            <div class="mt-4 text-right">
                <input id="ussId" name="ussId" type="text" class="hidden" value="<%=userStatus.getUssId() %>" />
                <button type="button" id="saveScColumn1Btn" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200 font-medium text-sm">
                    保存报考类型
                </button>
            </div>
        </div>
        <script type="text/javascript">
            // 保存报考类型的AJAX提交
            $(document).ready(function() {
            $('#saveScColumn1Btn').click(function() {
            var scColumn1Value = $('input[name="scColumn1"]:checked').val();
            var ussIdValue = $('#ussId').val();

            if (!scColumn1Value) {
                alert('请选择报考类型！');
                return;
            }

            var rowstr = {
                ussId: ussIdValue,
                scColumn1: scColumn1Value
            };

            $.ajax({
                url: '../zsUserStatusSetScColumn1.action',
                type: 'POST',
                data: {
                    rowstr: JSON.stringify(rowstr)
                },
                dataType: 'json',
                success: function(response) {
                    if (response.flag === 'success') {
                        alert('报考类型保存成功！');
                        // 刷新框架index.jsp页面
                        if (window.top && window.top.frames && window.top.frames['indexFrame']) {
                            window.top.frames['indexFrame'].location.reload();
                        } else if (window.parent && window.parent.frames && window.parent.frames['indexFrame']) {
                            window.parent.frames['indexFrame'].location.reload();
                        } else {
                            // 如果无法找到框架，尝试刷新父页面
                            window.parent.location.reload();
                        }
                    } else {
                        alert('保存失败，请重试！');
                    }
                },
                error: function() {
                    alert('网络错误，请重试！');
                }
            });
                });
            });
        </script>
        <!-- 选考科目卡片 -->
        <div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
            <h2 class="text-lg font-semibold text-gray-900 mb-4 flex items-center">
                <svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
                    <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v3.586L7.707 9.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 10.586V7z" clip-rule="evenodd"/>
                </svg>
                选考科目 <span class="text-red-500 ml-1">*</span>
            </h2>

            <div class="grid grid-cols-2 md:grid-cols-8 gap-8">
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="政治" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("政治"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">政治</span>
                </label>
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="历史" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("历史"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">历史</span>
                </label>
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="地理" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("地理"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">地理</span>
                </label>
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="物理" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("物理"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">物理</span>
                </label>
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="化学" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("化学"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">化学</span>
                </label>
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="生物" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("生物"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">生物</span>
                </label>
                <label class="inline-flex items-center p-3 border border-gray-200 rounded-lg cursor-not-allowed opacity-60">
                    <input type="checkbox" name="xyXkIss" id="xyXkIss" value="技术" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("技术"))out.print("checked=true"); %> disabled class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
                    <span class="ml-2 text-gray-700">技术</span>
                </label>
            </div>
        </div>

        <!-- 成绩填写表单 -->
        <form id="ff" name="add" role="form" class="form-horizontal" action="" method="post">
            <div class="card bg-white rounded-xl shadow-sm p-6 mb-6">
                <h2 class="text-lg font-semibold text-gray-900 mb-4 flex items-center">
                    <svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M6.267 3.455a3.066 3.066 0 001.745-.723 3.066 3.066 0 013.976 0 3.066 3.066 0 001.745.723 3.066 3.066 0 012.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 010 3.976 3.066 3.066 0 00-.723 1.745 3.066 3.066 0 01-2.812 2.812 3.066 3.066 0 00-1.745.723 3.066 3.066 0 01-3.976 0 3.066 3.066 0 00-1.745-.723 3.066 3.066 0 01-2.812-2.812 3.066 3.066 0 00-.723-1.745 3.066 3.066 0 010-3.976 3.066 3.066 0 00.723-1.745 3.066 3.066 0 012.812-2.812zm7.44 5.252a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                    </svg>
                    科目成绩 <span class="text-red-500 ml-1">*</span>
                </h2>

                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">政治成绩</label>
                        <input disabled="disabled" id="xyXkZz" name="xyXkZz" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkZz()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">历史成绩</label>
                        <input disabled="disabled" id="xyXkLs" name="xyXkLs" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkLs()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">地理成绩</label>
                        <input disabled="disabled" id="xyXkDl" name="xyXkDl" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkDl()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">物理成绩</label>
                        <input disabled="disabled" id="xyXkWl" name="xyXkWl" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkWl()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">化学成绩</label>
                        <input disabled="disabled" id="xyXkHx" name="xyXkHx" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkHx()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">生物成绩</label>
                        <input disabled="disabled" id="xyXkSw" name="xyXkSw" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkSw()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                    <div class="space-y-2">
                        <label class="block text-sm font-medium text-gray-700">技术成绩</label>
                        <input disabled="disabled" id="xyXkJs" name="xyXkJs" type="number" min="0" max="100" step="0.1"
                               class="input-focus w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 cursor-not-allowed opacity-50"
                               value="<%=html.getInputString(xy.getXyXkJs()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" oninput="validateScore(this)" placeholder="0-100分" />
                    </div>
                </div>
            </div>

            <!-- 隐藏字段 -->
            <input id="xyXkIs" name="xyXkIs" type="text" class="hidden" value="<%=xy.getXyXkIs() %>" />
            <input id="xyId" name="xyId" type="text" class="hidden" value="<%if(null==xy.getXyId()){out.print("");}else{out.print(xy.getXyId());}; %>" />
            <input id="zsUser.usId" name="zsUser.usId" type="text" class="hidden" value="<%=xy.getZsUser().getUsId() %>" />

            <!-- 按钮区域 -->
            <div class="text-center">
                <%if(Status.APPSTATUS_NULL.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NO.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NOTIME.getStatus().equals(userStatus.getAppStatus())){ %>
                <button type="submit" class="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200 font-medium">
                    保存信息
                </button>
                <%} else {%>
                <button type="submit" class="px-6 py-3 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed opacity-50 font-medium" disabled>
                    已确认
                </button>
                <%} %>
            </div>
        </form>
    </div>

    <!-- 填写需知 -->
    <div class="max-w-4xl mx-auto px-4 mb-8">
        <div class="bg-blue-50 border border-blue-200 rounded-lg p-6">
            <h3 class="text-lg font-semibold text-blue-900 mb-3 flex items-center">
                <svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
                    <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
                </svg>
                填写说明
            </h3>
            <div class="text-blue-800 text-sm"><%out.print(anconfig.getSingleConfigInfoByName("选考学考填写需知")); %></div>
        </div>
    </div>


<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script>


<script type="text/javascript">
var updateOneAction = '../zsXySave.action?randnum='+Math.floor(Math.random()*1000000);
var loactionurl = 'zs_xy.jsp';

$(document).ready(function(e) {
    $(".select1").uedSelect({
		width : 345
	});
	var checkBoxes = document.getElementsByName("xyXkIss");
	 for(var i=0;i<checkBoxes.length;i++){

  			if(checkBoxes[i].checked){
  				if(checkBoxes[i].value=="政治"){ $("#xyXkZz").removeAttr("disabled");}
			else if(checkBoxes[i].value=="历史"){$("#xyXkLs").removeAttr("disabled");}
			else if(checkBoxes[i].value=="地理"){$("#xyXkDl").removeAttr("disabled");}
			else if(checkBoxes[i].value=="物理"){$("#xyXkWl").removeAttr("disabled");}
			else if(checkBoxes[i].value=="化学"){$("#xyXkHx").removeAttr("disabled");}
			else if(checkBoxes[i].value=="生物"){$("#xyXkSw").removeAttr("disabled");}
			else if(checkBoxes[i].value=="技术"){$("#xyXkJs").removeAttr("disabled");}
  			}

  		}

});



$(function(){

	//jquery.validate
	$("#ff").validate({
		submitHandler: function() {
			var checkBoxes = document.getElementsByName("xyXkIss");
			var c=0;
			var a=new Array(3);
			for(var i=0;i<checkBoxes.length;i++){
				if(checkBoxes[i].checked){

					if(checkBoxes[i].value=="政治"){ a[c]=$("#xyXkZz").val();}
					else if(checkBoxes[i].value=="历史"){a[c]=$("#xyXkLs").val();}
					else if(checkBoxes[i].value=="地理"){a[c]=$("#xyXkDl").val();}
					else if(checkBoxes[i].value=="物理"){a[c]=$("#xyXkWl").val();}
					else if(checkBoxes[i].value=="化学"){a[c]=$("#xyXkHx").val();}
					else if(checkBoxes[i].value=="生物"){a[c]=$("#xyXkSw").val();}
					else if(checkBoxes[i].value=="技术"){a[c]=$("#xyXkJs").val();}
					c++;
				}
			}
			if (c<3 || ($("#xyXkZz").val()==''&&$("#xyXkLs").val()==''&&$("#xyXkDl").val()==''&&$("#xyXkWl").val()==''&&$("#xyXkHx").val()==''&&$("#xyXkSw").val()==''&&$("#xyXkJs").val()=='' )) {
			//if (c<3) {
				alert("选考科目必须选择3门并且把成绩填写完整！");
			} else {
				if((a[0]==''||a[1]==''||a[2]=='')){
					alert("选考科目必须选择3门并且把成绩填写完整！");
				}else{
				//验证通过后 的js代码写在这里
				submitFormAdvance();
				}
			}
		  }
		})

})

$(function(){ //禁用单选
        $("input[type='checkbox']").click(function(){
            this.checked = !this.checked;
        });
});

function setValue(obj){
    var checkBoxes = document.getElementsByName("xyXkIss");
    var textfield = document.getElementById("xyXkIs");
    textfield.value="";
    var limit=3, c=0;
    for(var i=0;i<checkBoxes.length;i++){
        if(checkBoxes[i].checked){
            c++;
            if (c>limit) {
                alert("选考科目限选3门！");
                obj.checked=false;
            } else {
                textfield.value+=checkBoxes[i].value+",";
            }
        }
    }
    if(!obj.checked){
        if(obj.value=="政治"){ $("#xyXkZz").val("");$("#xyXkZz").attr("disabled","disabled"); updateInputStyles();}
        else if(obj.value=="历史"){ $("#xyXkLs").val("");$("#xyXkLs").attr("disabled","disabled"); updateInputStyles();}
        else if(obj.value=="地理"){ $("#xyXkDl").val("");$("#xyXkDl").attr("disabled","disabled"); updateInputStyles();}
        else if(obj.value=="物理"){ $("#xyXkWl").val("");$("#xyXkWl").attr("disabled","disabled"); updateInputStyles();}
        else if(obj.value=="化学"){ $("#xyXkHx").val("");$("#xyXkHx").attr("disabled","disabled"); updateInputStyles();}
        else if(obj.value=="生物"){ $("#xyXkSw").val("");$("#xyXkSw").attr("disabled","disabled"); updateInputStyles();}
        else if(obj.value=="技术"){ $("#xyXkJs").val("");$("#xyXkJs").attr("disabled","disabled"); updateInputStyles();}
    } else if(obj.checked){
        if(obj.value=="政治"){ $("#xyXkZz").removeAttr("disabled"); updateInputStyles();}
        else if(obj.value=="历史"){$("#xyXkLs").removeAttr("disabled"); updateInputStyles();}
        else if(obj.value=="地理"){$("#xyXkDl").removeAttr("disabled"); updateInputStyles();}
        else if(obj.value=="物理"){$("#xyXkWl").removeAttr("disabled"); updateInputStyles();}
        else if(obj.value=="化学"){$("#xyXkHx").removeAttr("disabled"); updateInputStyles();}
        else if(obj.value=="生物"){$("#xyXkSw").removeAttr("disabled"); updateInputStyles();}
        else if(obj.value=="技术"){$("#xyXkJs").removeAttr("disabled"); updateInputStyles();}
    }
}

// 验证分数范围
function validateScore(input) {
    const value = parseFloat(input.value);
    if (isNaN(value) || value < 0 || value > 100) {
        input.classList.add('border-red-500', 'bg-red-50');
        input.classList.remove('border-green-500', 'bg-green-50');
        return false;
    } else {
        input.classList.remove('border-red-500', 'bg-red-50');
        input.classList.add('border-green-500', 'bg-green-50');
        return true;
    }
}

// 更新输入框样式
function updateInputStyles() {
    const inputs = document.querySelectorAll('#xyXkZz, #xyXkLs, #xyXkDl, #xyXkWl, #xyXkHx, #xyXkSw, #xyXkJs');
    inputs.forEach(input => {
        if (!input.disabled) {
            input.classList.remove('cursor-not-allowed', 'opacity-50');
            input.classList.add('bg-white', 'cursor-text', 'input-focus');
            // 验证当前值并更新样式
            validateScore(input);
        } else {
            input.classList.add('cursor-not-allowed', 'opacity-50');
            input.classList.remove('bg-white', 'cursor-text', 'border-red-500', 'border-green-500', 'bg-red-50', 'bg-green-50');
        }
    });
}

// 初始化样式和事件监听
document.addEventListener('DOMContentLoaded', function() {
    // 初始更新样式
    updateInputStyles();

    // 监听所有输入框的变化
    const inputs = document.querySelectorAll('input[type="number"]');
    inputs.forEach(input => {
        input.addEventListener('input', function() {
            validateScore(this);
        });
        input.addEventListener('blur', function() {
            validateScore(this);
        });
    });
});

		</script>

<%} %>		
</body>

</html>
